package arm.attestation.entity;

import arm.common.entity.ABaseEntity;
import arm.dic.entity.DicCategory;
import arm.dic.entity.DicMetricType;
import arm.dic.entity.DicPeriod;
import arm.dic.entity.DicPost;

import javax.persistence.*;

@Entity
@Table (name= "METRIC")

public class Metric extends ABaseEntity
{
    private DicMetricType dicMetricType;
    private DicPeriod dicPeriod;
    private DicPost dicPost;
    private DicCategory dicCategory;
    private Obiekt obiekt;
    private Long value;
    private Integer keyWorkplace;
    private Integer numberWorkplace;

    @ManyToOne
    @JoinColumn (name= "DIC_METRIC_TYPE_ID")
    public DicMetricType getDicMetricType() {
        return dicMetricType;
    }

    public void setDicMetricType(DicMetricType dicMetricType) {
        this.dicMetricType = dicMetricType;
    }


    @ManyToOne
    @JoinColumn (name= "DIC_PERIOD_ID")
    public DicPeriod getDicPeriod() {
        return dicPeriod;
    }

    public void setDicPeriod(DicPeriod dicPeriod) {
        this.dicPeriod = dicPeriod;
    }


    @ManyToOne
    @JoinColumn (name= "DIC_POST_ID")
    public DicPost getDicPost() {
        return dicPost;
    }

    public void setDicPost(DicPost dicPost) {
        this.dicPost = dicPost;
    }

    @ManyToOne
    @JoinColumn(name = "DIC_CATEGORY_ID")
    public DicCategory getDicCategory() {
        return dicCategory;
    }

    public void setDicCategory(DicCategory dicCategory) {
        this.dicCategory = dicCategory;
    }

    @ManyToOne
    @JoinColumn (name= "OBIEKT_ID")
    public Obiekt getObiekt() {
        return obiekt;
    }

    public void setObiekt(Obiekt obiekt) {
        this.obiekt = obiekt;
        if (obiekt != null)
        {
            setDicPeriod(obiekt.getDicPeriod());
        }
    }


    @Basic
    @Column (name= "VALUE")
    public Long getValue() {
        return value;
    }

    public void setValue(Long value) {
        this.value = value;
    }

    @Basic
    @Column (name= "KEY_WORKPLACE")
    public Integer getKeyWorkplace() {
        return keyWorkplace;
    }

    public void setKeyWorkplace(Integer keyWorkplace) {
        this.keyWorkplace = keyWorkplace;
    }

    @Basic
    @Column (name= "NUMBER_WORKPLACE")
    public Integer getNumberWorkplace() {
        return numberWorkplace;
    }

    public void setNumberWorkplace(Integer numberWorkplace) {
        this.numberWorkplace = numberWorkplace;
    }
}
